package com.free.semantic.core.common.serializeimpl.baseimpl;

import com.alibaba.fastjson.JSONObject;
import com.free.semantic.common.RelationItem;
import com.free.semantic.core.RelationFunction;
import com.free.semantic.core.common.serializeimpl.BaseSerializeImpl;
import com.free.semantic.core.funcimpl.SourceMapImpl;
import org.springframework.stereotype.Component;

@Component
public class SourceMap implements BaseSerializeImpl {

    private String sourceObj;

    public SourceMap(SourceMapImpl sourceMapImpl) {
        this.sourceObj = sourceMapImpl.getSourceObj();
    }

    public SourceMap() {

    }

    @Override
    public JSONObject getParameter() {
        JSONObject parameter = new JSONObject();
        parameter.put("sourceObj", sourceObj);
        return parameter;
    }

    @Override
    public RelationFunction fromParam(JSONObject parameter) {
        return new SourceMapImpl(parameter.getString("sourceObj"));
    }

}
